class PenjagaGenerator < Rails::Generator::Base
  def manifest
    record do |m|
      
      # Controller
      #m.file "lib/basic_auth.rb", "lib/basic_auth.rb"
      m.file "lib/penjaga.rb", "lib/penjaga.rb"
      m.file "controllers/user_controller.rb", "app/controllers/user_controller.rb"
      m.file "controllers/group_controller.rb", "app/controllers/group_controller.rb"

      # Models
      m.file "models/user.rb", "app/models/user.rb"
      m.file "models/notifications.rb", "app/models/notifications.rb"
      m.file "models/groupaction.rb", "app/models/groupaction.rb"
      m.file "models/usergroup.rb", "app/models/usergroup.rb"
      m.file "models/group.rb", "app/models/group.rb"
      m.file "models/groupacl.rb", "app/models/groupacl.rb"

      # Tests
      m.file "test/unit/user_test.rb", "test/unit/user_test.rb"
      m.file "test/functional/user_controller_test.rb", "test/functional/user_controller_test.rb"
      m.file "test/fixtures/users.yml", "test/fixtures/users.yml"

      # Views. 
      m.directory "app/views/notifications"
      m.file "views/notifications/forgot_password.rhtml", "app/views/notifications/forgot_password.rhtml"
      
      m.directory "app/views/user"
      m.file "views/user/login.rhtml", "app/views/user/login.rhtml"
      m.file "views/user/signup.rhtml", "app/views/user/signup.rhtml"
      m.file "views/user/change_password.rhtml", "app/views/user/change_password.rhtml"
      m.file "views/user/forgot_password.rhtml", "app/views/user/forgot_password.rhtml"
      m.file "views/user/welcome.rhtml", "app/views/user/welcome.rhtml"
      m.file "views/user/show.html.erb", "app/views/user/show.html.erb"
      m.file "views/user/edit.rhtml", "app/views/user/edit.rhtml"
      m.file "views/user/edit.rhtml", "app/views/user/edit.rhtml"      

      m.directory "app/views/group"
      m.file "views/group/manage_acl.rhtml", "app/views/group/manage_acl.rhtml"
      m.file "views/group/manage_member.rhtml", "app/views/group/manage_member.rhtml"
      m.file "views/group/notauthorized.rhtml", "app/views/group/notauthorized.rhtml"
      m.file "views/group/result.rhtml", "app/views/group/result.rhtml"
      m.file "views/group/user_edit.rhtml", "app/views/group/user_edit.rhtml"
      m.file "views/group/user_password.rhtml", "app/views/group/user_password.rhtml"
      m.file "views/group/user_show.html.erb", "app/views/group/user_show.html.erb"
      

      m.migration_template "migrate/create_users.rb", "db/migrate", :migration_file_name => "create_users"
      m.sleep 1   # to make sure the time stamp is not same
      m.migration_template "migrate/create_usergroups.rb", "db/migrate", :migration_file_name => "create_usergroups"
      m.sleep 1
      m.migration_template "migrate/create_groups.rb", "db/migrate", :migration_file_name => "create_groups"
      m.sleep 1
      m.migration_template "migrate/create_groupactions.rb", "db/migrate", :migration_file_name => "create_groupactions"
      m.sleep 1
      m.migration_template "migrate/create_groupacls.rb", "db/migrate", :migration_file_name => "create_groupacls"
      
      # Initializer (for gmail)
      m.file "initializers/actionmailer_penjaga_gmail.rb", "config/initializers/actionmailer_penjaga_gmail.rb"
      
      m.directory "public/images"
      m.file "images/penjaga_button.png", "public/images/penjaga_button.png"

      m.readme "INSTALL"
    end
  end
  
  #def file_name
  #  "create_users"
  #end

end
